package com.zte.purchase.control;

import com.zte.market.pojo.Custom;
import com.zte.market.pojo.Province;
import com.zte.market.service.CityService;
import com.zte.market.service.ProvinceService;
import com.zte.purchase.pojo.PurchaseCFirm;
import com.zte.purchase.service.impl.PurchaseImpl;
import com.zte.util.PageModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author luode
 * @version 1.0
 * @date 2022/10/02 星期日 17:41
 */

@Controller
@RequestMapping("/purchase")
public class PurchaseAction {

    @Autowired
    private CityService cityService;

    @Autowired
    private PurchaseImpl purchase;

    @Autowired
    private ProvinceService provinceService;

    /**
     * 跳转采购单管理界面
     * @return
     */
    @RequestMapping("/purchaseList")
    public String purchaseList(){
        return "purchase/purchase/purchaseList";
    }

    /**
     * 跳转添加采购单界面
     * @return
     */
    @RequestMapping("/purchaseAdd")
    public String purchaseAdd(){
        return "purchase/purchase/purchaseAdd";
    }

    /**
     * 跳转修改采购单页面
     * @return
     */
    @RequestMapping("/purchaseUpdate")
    public String purchaseUpdate(){
        return "purchase/purchase/purchaseUpdate";
    }

    /**
     * 跳转采购单详情页面
     * @return
     */
    @RequestMapping("/purchaseView")
    public String purchaseView(){
        return "purchase/purchase/purchaseView";
    }

    /**
     * 跳转采购单审核界面
     * @return
     */
    @RequestMapping("/purchaseExamineList")
    public String purchaseExamineList(){
        return "purchase/purchaseExamine/purchaseExamineList";
    }

    /**
     * 跳转采购单审核操作界面
     * @return
     */
    @RequestMapping("/purchaseExamine")
    public String purchaseExamine(){
        return "purchase/purchaseExamine/purchaseExamine";
    }

    /**
     * 跳转品牌管理界面
     * @return
     */
    @RequestMapping("/brandList")
    public String brandList(){
        return "purchase/brand/brandList";
    }

    /**
     * 跳转增加品牌界面
     * @return
     */
    @RequestMapping("/brandAdd")
    public String brandAdd(){
        return "purchase/brand/brandAdd";
    }

    /**
     * 跳转修改品牌界面
     * @return
     */
    @RequestMapping("/brandUpdate")
    public String brandUpdate(){
        return "purchase/brand/brandUpdate";
    }

    /**
     * 跳转商品类型管理界面
     * @return
     */
    @RequestMapping("/productTypeList")
    public String productTypeList(){
        return "purchase/productType/productTypeList";
    }

    /**
     * 跳转添加商品类型界面
     * @return
     */
    @RequestMapping("/productTypeAdd")
    public String productTypeAdd(){
        return "purchase/productType/productTypeAdd";
    }

    /**
     * 跳转修改商品类型界面
     * @return
     */
    @RequestMapping("/productTypeUpdate")
    public String productTypeUpdate(){
        return "purchase/productType/productTypeUpdate";
    }

    /**
     * 跳转商品管理界面
     * @return
     */
    @RequestMapping("/productList")
    public String productList(){
        return "purchase/product/productList";
    }

    /**
     * 跳转增加商品界面
     * @return
     */
    @RequestMapping("/productAdd")
    public String productAdd(){
        return "purchase/product/productAdd";
    }

    /**
     * 跳转修改商品界面
     * @return
     */
    @RequestMapping("/productUpdate")
    public String productUpdate(){
        return "purchase/product/productUpdate";
    }

    /**
     * 跳转厂商管理界面
     * @return
     */
    @RequestMapping("/manufacturerList")
    public String manufacturerList(HttpSession session){
        //获取全省列表
        List<Province> provinceList = provinceService.queryProvinces();
        //获取全部客户信息
        List<PurchaseCFirm> firmList = purchase.getAllFirm();
        //客户分页
        PageModel<PurchaseCFirm> firmPage = purchase.queryByPage(firmList, 7, 1);
        session.setAttribute("provinceList",provinceList);
//        session.setAttribute("customList",customList);
        session.setAttribute("firmPage",firmPage);

        return "purchase/manufacturer/manufacturerList";
    }

    /**
     * 跳转添加厂商界面
     * @return
     */
    @RequestMapping("/manufacturerAdd")
    public String manufacturerAdd(){
        return "purchase/manufacturer/manufacturerAdd";
    }

    /**
     * 跳转厂商详情界面
     * @return
     */
    @RequestMapping("/manufacturerView")
    public String manufacturerView(){
        return "purchase/manufacturer/manufacturerView";
    }

    /**
     * 跳转修改厂商界面
     * @return
     */
    @RequestMapping("/manufacturerUpdate")
    public String manufacturerUpdate(){
        return "purchase/manufacturer/manufacturerUpdate";
    }
}
